package com.gs.djys.main;

import android.content.Context;

import com.alibaba.fastjson.JSON;
import com.gs.djys.Base.BaseBean;
import com.gs.djys.Base.MyAppliCation;
import com.gs.djys.Base.Urls;
import com.gs.djys.mvp.BasePresenterImpl;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.callback.StringCallback;
import com.lzy.okgo.model.Response;

/**
 * MVPPlugin
 *  邮箱 784787081@qq.com
 */

public class MainPresenter extends BasePresenterImpl<MainContract.View> implements MainContract.Presenter{

    @Override
    public void getUserCode(String userCode) {
        OkGo.<String>post(Urls.SERVER + "/road/lictran/licApp/admin/findZqyjUserType")
                .params("user_code", userCode)
                .execute(new StringCallback() {
                    @Override
                    public void onSuccess(Response<String> response) {
                        BaseBean landBean = JSON.parseObject(response.body(),BaseBean.class);
                        mView.getUserCodes(landBean);
                    }
                });
    }
    @Override
    public void getSnRoles(String userCode) {
        OkGo.<String>post(Urls.SERVER + "/road/lictran/licApp/admin/findSnRoles")
                .params("user_code", userCode)
                .execute(new StringCallback() {
                    @Override
                    public void onSuccess(Response<String> response) {
                        BaseBean landBean = JSON.parseObject(response.body(),BaseBean.class);
                        mView.getSnRoless(landBean);
                    }
                });
    }

}
